package com.huaxin.feignclient.device;

import com.huaxin.feignclient.device.models.DeviceDataCollectionWideAddDTO;
import com.huaxin.feignclient.device.models.DeviceInstance;
import com.huaxin.feignclient.device.models.ElectricalRoom;
import com.huaxin.feignclient.device.models.SwitchCabinet;
import com.huaxin.feignclient.models.ResponseResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Component
@FeignClient(name = "device-client", url = "${feignService.device:http://localhost:46832}")
public interface DeviceClient {
    //添加设备数据
    @PostMapping("/v1/device/deviceDataCollectionWide/addDeviceData")
    boolean addDeviceData(@RequestBody List<DeviceDataCollectionWideAddDTO> deviceDataCollectionWide, @RequestParam(name = "stationNumber", required = true) String stationNumber);

    @Operation(summary = "根据设备autoId查询设备实例", description = "根据设备autoId查询设备实例")
    @GetMapping("/v1/device/deviceInstance/queryDeviceInstanceByAutoId")
    DeviceInstance queryDeviceInstanceByAutoId(@RequestParam(name = "autoId", required = true) Long autoId);

    @Operation(summary = "根据ID列表查询变电箱列表", description = "根据ID列表查询变电箱列表")
    @PostMapping("/v1/device/switchCabinet/list")
    ResponseResult<List<SwitchCabinet>> cabinetListByIds(@RequestBody List<String> ids);

    @Operation(summary = "根据组织ID查询变电箱列表", description = "根据组织ID查询变电箱列表")
    @GetMapping("/v1/device/switchCabinet/listByOrgId")
    ResponseResult<List<SwitchCabinet>> cabinetListByOrgId(@Parameter(description = "组织ID", example = "org-01") @RequestParam(value = "orgId", required = true) String orgId);

    @Operation(summary = "根据组织ID列表查询变电箱列表", description = "根据组织ID列表查询变电箱列表")
    @PostMapping("/v1/device/switchCabinet/listByOrgIds")
    ResponseResult<List<SwitchCabinet>> cabinetListByOrgIds(@RequestBody List<String> orgIds);

    @Operation(summary = "根据家庭ID查询变电箱列表", description = "根据家庭ID查询变电箱列表")
    @GetMapping("/v1/device/switchCabinet/listByFamilyId")
    ResponseResult<List<SwitchCabinet>> cabinetListByFamilyId(@Parameter(description = "家庭ID", example = "family-01") @RequestParam(value = "familyId", required = true) String familyId);

    @Operation(summary = "根据家庭ID查询变电箱列表", description = "根据家庭ID查询变电箱列表")
    @PostMapping("/v1/device/switchCabinet/listByFamilyIds")
    ResponseResult<List<SwitchCabinet>> cabinetListByFamilyIds(@RequestBody List<String> familyIds);

    @Operation(summary = "根据ID列表查询配电房", description = "根据ID列表查询配电房")
    @PostMapping("/v1/device/electricalRoom/list")
    ResponseResult<List<ElectricalRoom>> electricalRoomListByIds(@RequestBody List<String> ids);

    //根据企业id查询设备报警通知数量
    @GetMapping("/v1/device/queryDeviceAlarmNotificationCountByOrgId")
    @Operation(summary = "根据企业id查询设备报警通知数量", description = "根据企业id查询设备报警通知数量")
    ResponseResult<Long> queryDeviceAlarmNotificationCountByOrgId(@Parameter(description = "企业id", required = true, name = "orgId") @RequestParam(name = "orgId", required = true) String orgId);
}
